<template>
	<view class="mx-recom-card-item" @tap="onTap">
		<view class="card-img" :style="{backgroundImage: `url(${icon})`}"></view>
		<view class="card-info">
			<view class="card-name">{{info.name}}</view>
			<view v-if="info.type == 1" class="card-effect">使用次数：{{info.limite}}次</view>
			<view v-if="info.type == 0" class="card-effect">有效期：{{info.effective}}天</view>
			<view class="card-amount">￥{{info.price}}</view>
		</view>
	</view>
</template>

<script>
	import { imgUrl } from '@/utils/config.js'
	export default {
		props: {
			info: {
				type: Object
			}
		},
		computed: {
			icon() { 
				return imgUrl + this.info.image.file_path
			}
		},
		
		methods: {
			onTap() {
				uni.navigateTo({
					url: `/pages/vip-card/vip-card?nid=${this.info.nid}`
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	@import '@/common/scss/mixins.scss';
	@import '@/common/scss/var.scss';
	.mx-recom-card-item{
		box-sizing: border-box;
		width: 312rpx;
		display: inline-flex;
		flex-direction: column;
		.card-img{
			width: 100%;
			height: 194rpx;
			border-radius: 4px;
			@include bg-img-cover;
		}
		
		.card-info{
			box-sizing: border-box;
			padding: 20rpx 10rpx 0;
			font-size: 14px;
			font-family: $font-family;
			
			.card-name{
				font-size: 16px;
				font-weight: bold;
			}
			
			.card-effect{
				margin-top: 14rpx;
				margin-bottom: 10rpx;
				font-size: 14px;
				color: $color-info;
			}
			
			.card-amount{
				font-weight: bold;
				font-size: 14px;
				color: $color-amount;
			}
		}
	}
</style>
